#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 55;
const int T = 2505;

int n, m, t;
int a[N][N];
int f[N][N];
int g[N][N]
     [2];  // g[i][j][c] means first i grids, j stroks, with the last grid c
int dp[T];
void solve_row(int row) {
  rep(i, 1, m) rep(j, 1, m) {
    g[i][j][0] =
        (a[row][i] == 0 ? 1 : 0) + max(g[i - 1][j - 1][1], g[i - 1][j][0]);
    g[i][j][1] =
        (a[row][i] == 1 ? 1 : 0) + max(g[i - 1][j - 1][0], g[i - 1][j][1]);
  }
  rep(j, 1, m) f[row][j] = max(g[m][j][0], g[m][j][1]);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> t;
  rep(i, 1, n) rep(j, 1, m) {
    char c;
    cin >> c;
    a[i][j] = c - '0';
  }
  rep(i, 1, n) {
    solve_row(i);
    per(j, t, 1) rep(k, 1, min(m, j)) dp[j] = max(dp[j], dp[j - k] + f[i][k]);
  }
  cout << dp[t];
  return 0;
}